const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */

// mix.js('resources/js/app.js', 'public/js')
//     .postCss('resources/css/app.css', 'public/css', [
//         //
//     ]);


const path = require('path');

mix.js('resources/js/admin/admin-spa/app.js', 'public/js/admin/admin-spa')
   .vue({ version: 3 })
   .sass('resources/sass/admin.scss', 'public/css/admin')
   .sourceMaps(!mix.inProduction(), 'source-map')
   .version()
   .extract(['vue', 'element-plus', 'axios']);

// Webpack 配置
mix.webpackConfig({
    resolve: {
        extensions: ['.js', '.vue', '.json'],
        alias: {
            '@': path.resolve(__dirname, 'resources/js'),
        },
    },
    watchOptions: {
        poll: mix.inProduction() ? false : 1000, // 开发环境启用轮询
        ignored: /node_modules/,
    }
});
 